package com.spring.demo.springdemo.config;

import com.spring.demo.springdemo.GoodService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @Author RenPu
 * @Date 2024/2/17 16:42
 * @Version 1.0
 * @Description: 实现对BeanFactory进行操作，例如创建新得bean存放到容器中
 **/

@Component
public class BeanFactoryPostProgrecessCof implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

        beanFactory.registerSingleton("ZZZ",new GoodService("MAc 黑窑"));
//        beanFactory.getBeanDefinition(""); //获取容器中得Bean对象根据BeanName


    }
}
